# 定义基类  
class Animal:  
    def make_sound(self):  
        raise NotImplementedError("子类必须实现这个方法")  
  
# 定义Dog类，继承自Animal  
class Dog(Animal):  
    def make_sound(self):  
        return "Woof!"  
  
# 定义Cat类，继承自Animal  
class Cat(Animal):  
    def make_sound(self):  
        return "Meow!"  
  
# 定义Bird类，继承自Animal  
class Bird(Animal):  
    def make_sound(self):  
        return "Tweet!"  
  
# 多态性应用示例  
def animal_sound(animal):  
    print(animal.make_sound())  
  
# 创建对象  
dog = Dog()  
cat = Cat()  
bird = Bird()  
  
# 调用同一个函数，传入不同类型的对象，展示多态性  
animal_sound(dog)  # 输出: Woof!  
animal_sound(cat)  # 输出: Meow!  
animal_sound(bird) # 输出: Tweet!